//make font style for option, dont work with IE
function t3_gfont_style(){
	var elements = ['global', 'logo', 'slogan', 'blocktitle','pageheading', 'nodeheading','mainnav'];
	
	
	for(i=0;i<elements.length;i++){
		var elmid = 'edit-gfont-' + elements[i];
		
		var options = jQuery('#' + elmid + " option");
		options.each(function(i, op){
			var font_name = jQuery(op).attr('value');
			jQuery(op).attr('style','font-family:"' + font_name + '::Menu";');
		});
		
		var div = jQuery('#edit-gfont-'+elements[i]+'-wrapper');
		var divcustom = jQuery('#div-gfont-' + elements[i]);
		
		divcustom.appendTo(div);
	}
}

//toggle custom css box
function t3_gfont_custombox(id){
	var boxid = '#' + id + "-style";
	
	if(jQuery(boxid).is(':visible')){
		if(t3_profiles[t3_current_profile]['gfont_'+id+'.style']){
			delete t3_profiles[t3_current_profile]['gfont_'+id+'.style'];
		}
		jQuery(boxid).hide();
	}else{
		jQuery(boxid).show();
		var value = jQuery(boxid).attr('value');
		value = value.replace(/[\n\t]+/, '\\n');
		t3_profiles[t3_current_profile]['gfont_'+id+'.style'] = value; 
	}
}

//execute gfont script
jQuery(document).ready(function(){
	t3_gfont_style();
});